<!DOCTYPE html>
<title>Test that the autoplay muted via attribute allows change in src</title>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<video muted autoplay></video>
<script>
async_test(t => {
  t.add_cleanup(() => {
    internals.settings.setAutoplayPolicy('no-user-gesture-required');
    internals.runtimeFlags.autoplayMutedVideosEnabled = false;
  });
  internals.settings.setAutoplayPolicy('document-user-activation-required');
  internals.runtimeFlags.autoplayMutedVideosEnabled = true;

  var video = document.querySelector('video');
  video.src = '../content/test.ogv';
  video.addEventListener('play', t.step_func(e => {
    setTimeout(t.step_func(() => {
      video.src = '../content/counting.ogv';
      video.addEventListener('play', t.step_func_done());
    }));
  }), { once: true });
});
</script>
